ostree-grub-generator: sort BLS files by version instead of alphabetically
authorJavier Martinez Canillas <javierm@redhat.com>
Wed, 27 Jun 2018 10:19:26 +0000 (12:19 +0200)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 27 Jun 2018 14:20:29 +0000 (14:20 +0000)
The ostree-grub-generator populates the grub.cfg menu entries using the
BLS config files. But it uses the ls command that by default sorts the
entries alphabetically, so the order won't be correct if there are more
than 10 deployments, i.e:

$ ls -1 /boot/loader/entries/
ostree-fedora-workstation-0.conf
ostree-fedora-workstation-10.conf
ostree-fedora-workstation-1.conf
...

So instead the -v option should be used to make ls use version sorting:

$ ls -1 -v /boot/loader/entries/
ostree-fedora-workstation-0.conf
ostree-fedora-workstation-1.conf
...
ostree-fedora-workstation-10.conf

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Closes: #1653
Approved by: cgwalters

src/boot/grub2/ostree-grub-generator

index 97ef4d69fbcd9f856cebb5493655d1fb2b3f8c95..bfae55a572f16d74eb554cbd19f462c583e2f867 100644 (file)
@@ -66,7 +66,7 @@ populate_menu()
     else
         boot_prefix="${OSTREE_BOOT_PARTITION}"
     fi
-    for config in $(ls $entries_path/*.conf); do
+    for config in $(ls -v $entries_path/*.conf); do
         read_config ${config}
         menu="${menu}menuentry '${title}' {\n"
         menu="${menu}\t linux ${boot_prefix}${linux} ${options}\n"